﻿using System.Dynamic;
using Basic.FormGatewaryModular.Interface;
using Basic.FormRemoteModel.FormView.Model;
using Basic.FormRemoteModel.FormViewCol.Model;
using WeDonekRpc.ApiGateway.Attr;
using WeDonekRpc.Client;
using WeDonekRpc.Helper.Validate;
using WeDonekRpc.HttpApiGateway;
using WeDonekRpc.HttpApiGateway.Model;

namespace Basic.FormGatewaryModular.Api
{
    [ApiRouteName("/form/view/{name}")]
    internal class FormViewApi : ApiController
    {
        private readonly IFormViewService _Service;

        public FormViewApi ( IFormViewService service )
        {
            this._Service = service;
        }

        public long Add ( FormViewAdd data )
        {
            return this._Service.Add(data);
        }

        public void Delete ( [NumValidate("form.view.id.error", 1)] long id )
        {
            this._Service.Delete(id);
        }

        public FormViewDto Find ( [NumValidate("form.id.error", 1)] long formId )
        {
            return this._Service.Find(formId);
        }
        public void Generate ( [NumValidate("form.id.error", 1)] long formId )
        {
            this._Service.Generate(formId);
        }
        public ViewBody GetBody ( [NumValidate("form.id.error", 1)] long formId )
        {
            return this._Service.GetBody(formId);
        }

        public PagingResult<ExpandoObject> Query ( PagingParam<long> param )
        {
            return this._Service.Query(param);
        }

        public bool Set ( LongParam<FormViewSet> set )
        {
            return this._Service.Set(set);
        }
    }
}
